package Structural_design_pattern.Facade_Pattern.Example1;

public class SmartApplianceFacade {
    private Light light;
    private Tv tv;
    private Airconditioner airConditioner;

    public SmartApplianceFacade() {
        light = new Light();
        tv = new Tv();
        airConditioner = new Airconditioner();
    }

    public void say(String message)
    {
        if(message.contains("打开")){
            on();
        }else if(message.contains("关闭")){
            off();
        }else{
            System.out.println("我不明白你的意思");
        }
    }

    public void on(){
        light.on();
        tv.on();
        airConditioner.on();
    }

    public void off(){
        light.off();
        tv.off();
        airConditioner.off();
    }

}
